package org.xbzheng.restful_study.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.xbzheng.restful_study.model.Room;
import org.xbzheng.restful_study.service.RoomService;
import org.xbzheng.restful_study.util.ResponseEntity;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Created by Administrator on 2016/11/2.
 */
@Controller
@RequestMapping("/index")
public class IndexController extends BaseController{

    @Autowired
    private RoomService roomService;

    @RequestMapping("/")
    public String index(HttpServletRequest request){
        List<Room> rooms = roomService.findRooms();
        request.setAttribute("rooms", rooms);
        return "main";
    }
}
